<!--检票数据查询列表页-->
<template>
    <div style="height: 100%;">
        <m-page-list
                :option="option"
                :page="page"
                :total="total"
                :table-data="tableData"
                :table-loading="tableLoading"
                v-model:value="query"
                @h-btn-click="hBtnClick"
                @col-btn-click="colBtnClick"
                @search-data="searchData"
        />
    </div>

</template>

<script setup>

  import {ref,reactive,onMounted,nextTick} from 'vue'
  //组件
  import MPageList from '@/components/PageList'
  //请求
  import {getCheckTicket,} from '@/request/api/basicData'

  import {usePageList} from "../../composables/pageList";

  //引用类型字段参数
  import {refOpt} from "../const";

  let opts = {
    // auth_id: 'stop',
    getApi: getCheckTicket,
  };
  let {option,page,total,tableLoading,tableData,query,dialogRef,dialogShow,
    hBtnClick,colBtnClick,searchData,} = usePageList(opts);

  option.hLBtns = [];
  option.colBtns = [];

  option.conditions = [
    {label: '检票日期',type: 'daterange',field_id: ['begin_date','end_date'],length: 'YYYY-MM-DD',col: 12},
    {label: '订单编号',type: 'text',field_id: 'out_trade_no',col: 12},
    {...refOpt.shuttle_name,rewriteInput: true,col: 12},
    {label: '乘客名称',type: 'text',field_id: 'passenger_name',col: 12},
  ];
  option.cols = [
    {prop: 'out_trade_no', label: '订单编号',},
    {prop: 'get_on_stop_name', label: '上车站点',},
    {prop: 'get_on_checker_name', label: '上车检票人',},
    {prop: 'get_on_time', label: '上车时间',},
    {prop: 'get_on_addr', label: '上车地点',},
    {prop: 'get_on_addr_longitude', label: '上车地点经度',},
    {prop: 'get_on_addr_latitude', label: '上车地点纬度',},
    {prop: 'shuttle_id', label: '班次编号',},
    {prop: 'shuttle_name', label: '班次名称',},
    {prop: 'shuttle_direction', label: '班次方向',templte: (scope) =>{
        let row = scope.row,
          {shuttle_direction} = row,
          type =[1].includes(shuttle_direction) ? '去程' : [2].includes(shuttle_direction) ? '回程' : '';
        return `<div>${type}</div>`;
      } ,},
    {prop: 'passenger_name', label: '乘客名称',},
    {prop: 'is_valid', label: '是否有效',templte: (scope) =>{
        let row = scope.row,
          {is_valid} = row,
          type =[true,1].includes(is_valid) ? '有效' : [false,0].includes(is_valid) ? '无效' : '';
        return `<div>${type}</div>`;
      } },
    {prop: 'void_ticket_user_name', label: '作废人',},
    {prop: 'void_ticket_time', label: '作废时间',},
    {prop: 'is_get_off', label: '下车标识',templte: (scope) =>{
        let row = scope.row,
          {is_get_off} = row,
          type =[true,1].includes(is_get_off) ? '已下车' : [false,0].includes(is_get_off) ? '未下车' : '';
        return `<div>${type}</div>`;
      },},
    {prop: 'get_off_stop_name', label: '下车站点',},
    {prop: 'get_off_checker_name', label: '下车检票人',},
    {prop: 'get_off_time', label: '下车时间',},
    {prop: 'get_off_addr', label: '下车地点',},
    {prop: 'get_off_addr_longitude', label: '下车地点经度',},
    {prop: 'get_off_addr_latitude', label: '下车地点纬度',},

  ];

</script>

